Core Functions ¶
-
ee_status
EE_Init
(
ee_object_t
*
ee_object
,
ee_erase_type
erase_type
)
¶
-
Restore the pages to a known good state in case of power loss. If a page is in RECEIVE state, resume transfer. Then if some pages are ERASING state, erase these pages.
- Parameters :
-
ee_object – pointer on eeprom_emulation object
erase_type – ee_erase_type Type of erase to apply on page requiring to be erased.
- Return values :
-
ee_status – refer to ee_status for possible return values
EE_OK: operation finished successfully
EE_ERROR_CORRUPTION(FLITF Algo): the algo was not able to recover data
EE_ERROR_FLASH_ITF : an error is returned by flash interface
-
ee_status
EE_ReadVariable96bits
(
uint16_t
virt_address
,
uint64_t
*
p_data
)
¶
-
Returns the last stored variable data, if found, which correspond to the passed virtual address.
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
p_data – 96bits data to be written pointed by a uin64_t pointer
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_ERROR_ALGO(FLITF Algo): if no active page found
EE_INVALID_VIRTUALADDRESS: if try to read from an invalid address
EE_INFO_NODATA: if no valid data is available
EE_INFO_NOTSUPPORTED: if called when ALGO NVM selected
-
ee_status
EE_ReadVariable32bits
(
uint16_t
virt_address
,
uint32_t
*
p_data
)
¶
-
Returns the last stored variable data, if found, which correspond to the passed virtual address.
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
p_data – Variable containing the 32bits read variable value
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_ERROR_ALGO(FLITF Algo): if no active page found
EE_INVALID_VIRTUALADDRESS: if try to read from an invalid address
EE_INFO_NODATA: if no valid data is available
-
ee_status
EE_ReadVariable16bits
(
uint16_t
virt_address
,
uint16_t
*
p_data
)
¶
-
Returns the last stored variable data, if found, which correspond to the passed virtual address.
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
p_data – Variable containing the 16bits read variable value
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_ERROR_ALGO: if algo return an error
EE_INVALID_VIRTUALADDRESS: if try to read from an invalid address
EE_INFO_NODATA: if no valid data is available
-
ee_status
EE_ReadVariable8bits
(
uint16_t
virt_address
,
uint8_t
*
p_data
)
¶
-
Returns the last stored variable data, if found, which correspond to the passed virtual address.
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
p_data – Variable containing the 8bits read variable value
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_ERROR_ALGO: if algo return an error
EE_INVALID_VIRTUALADDRESS: if try to read from an invalid address
EE_INFO_NODATA: if no valid data is available
-
ee_status
EE_WriteVariable96bits
(
uint16_t
virt_address
,
const
uint64_t
*
data
)
¶
-
Writes/updates variable data in EEPROM. Trig internal Pages transfer if half of the pages are full.
Warning
This function is not reentrant
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
data – 96bits data to be written pointed by a uin64_t pointer
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_INVALID_VIRTUALADDRESS: if write in an invalid address
EE_ERROR_ALGO(FLITF Algo): if an error during writing operation
EE_ERROR_ITF_CRC(FLITF Algo): if an crc calculation error occurred
EE_INFO_CLEANUP_REQUIRED(FLITF Algo): success and user has to trig flash pages cleanup
EE_INFO_NOTSUPPORTED(NVM Algo): if called when ALGO NVM selected
-
ee_status
EE_WriteVariable32bits
(
uint16_t
virt_address
,
uint32_t
data
)
¶
-
Writes/updates variable data in EEPROM. Trig internal Pages transfer if half of the pages are full.
Warning
This function is not reentrant
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
data – 32bits data to be written
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_ERROR_ALGO: if an error during writing operation
EE_INVALID_VIRTUALADDRESS: if write in an invalid address
EE_ERROR_ITF_CRC(FLITF Algo): if an crc calculation error occurred
EE_INFO_CLEANUP_REQUIRED(FLITF Algo): success and user has to trig flash pages cleanup
-
ee_status
EE_WriteVariable16bits
(
uint16_t
virt_address
,
uint16_t
data
)
¶
-
Writes/updates variable data in EEPROM. Trig internal Pages transfer if half of the pages are full.
Warning
This function is not reentrant
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
data – 16bits data to be written
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_INVALID_VIRTUALADDRESS: if write in an invalid address
EE_ERROR_ALGO(FLITF Algo): if no active page found
EE_ERROR_ITF_CRC(FLITF Algo): if an crc calculation error occurred
EE_INFO_CLEANUP_REQUIRED(FLITF Algo): success and user has to trig flash pages cleanup
-
ee_status
EE_WriteVariable8bits
(
uint16_t
virt_address
,
uint8_t
data
)
¶
-
Writes/updates variable data in EEPROM. Trig internal Pages transfer if half of the pages are full.
Warning
This function is not reentrant
- Parameters :
-
virt_address – Variable virtual address on 16 bits (can’t be 0x0000 or 0xFFFF)
data – 8bits data to be written
- Return values :
-
ee_status – refer to ee_status
EE_OK: operation finished successfully
EE_INVALID_VIRTUALADDRESS: if write in an invalid address
EE_ERROR_ITF_CRC(FLITF Algo): if an crc calculation error occurred
EE_INFO_CLEANUP_REQUIRED(FLITF Algo): success and user has to trig flash pages cleanup
-
ee_status
EE_CleanUp
(
void
)
¶
-
Erase group of pages which are erasing state, in polling mode. Could be either first half or second half of total pages number.
Note
This function must be called when EE_WriteVariableXXbits has returned EE_INFO_CLEANUP_REQUIRED status (and only in that case)
- Return values :
-
ee_status –
EE_OK: in case of success
EE error code: if an error occurs
EE_INFO_NOTSUPPORTED(NVM Algo): if called when ALGO NVM selected
-
ee_status
EE_CleanUp_IT
(
ee_operation_callback_t
operation_complete
)
¶
-
Erase group of pages which are erasing state, in IT mode. Could be either first half or second half of total pages number.
Note
This function must be called when EE_WriteVariableXXbits has returned EE_INFO_CLEANUP_REQUIRED status (and only in that case)
- Parameters :
-
operation_complete – this variable is used to return the operation status
- Return values :
-
ee_status –
EE_OK: in case of success
EE_INFO_NOERASING_PAGE(Algo FLITF): if no erase page found
EE_INFO_NOTSUPPORTED(NVM Algo): if called when ALGO NVM selected
-
ee_status
EE_CleanUpProgressive
(
void
)
¶
-
Erase the pages requiring cleanup progressively, in polling mode. Each call performs a bounded amount of work (time budget EE_CLEANUP_PROGRESSIVE_TIME_MS), so it can be called repeatedly from the application main loop without blocking time-critical processing.
Note
This function must be called when EE_WriteVariableXXbits has returned EE_INFO_CLEANUP_REQUIRED status (and only in that case). It must be called again as long as it returns EE_INFO_CLEANUP_REQUIRED.
- Return values :
-
ee_status –
EE_OK: cleanup is complete, no more call required
EE_INFO_CLEANUP_REQUIRED(FLITF Algo): cleanup ongoing, call again
EE error code: if an error occurs
EE_INFO_NOTSUPPORTED(NVM Algo): if called when ALGO NVM selected
-
ee_operation_status
EE_GetStatusCleanUp_IT
(
void
)
¶
-
return the status of cleanup interrupt operation.
Note
This function must be called when calling EE_FLITF_CleanUp_IT to control the end of the operation and before any new eeprom operation.
- Return values :
-
ee_operation_status – Refer to ee_operation_status for possible return values.
-
ee_status
EE_Format
(
ee_erase_type
erase_type
)
¶
-
Erases all flash pages of eeprom emulation, and set first page header as ACTIVE.
Note
This function can be called the very first time eeprom emulation is used, to prepare flash pages for eeprom emulation with empty eeprom variables. It can also be called at any time, to flush all eeprom variables.
- Parameters :
-
erase_type – ee_erase_type Type of erase to apply on page requiring to be erased.
- Return values :
-
ee_status –
EE_OK: on success
EE error code: if an error occurs
EE_INFO_NOTSUPPORTED(NVM Algo): if called when ALGO NVM selected